package com.openjawtech.xscraper.scraper;

import java.io.File;
import com.openjawtech.xscraper.scraper.runtime.threads.ActionType;
import com.openjawtech.xscraper.scraper.runtime.threads.ScrapeThread;

/**
 * excute
 *
 */
public class RunApp
{
    public static void main( String[] args )
    {
        org.apache.log4j.PropertyConfigurator.configure("./config/log4j.properties");
        StartupConfiguration startupConf = new StartupConfiguration();
        startupConf.init();
        ScrapeConfiguration scrapeConf = new ScrapeConfiguration(startupConf.getConfigProperties());

        for (File htmlDir : scrapeConf.getHTMLDirs()) {
            ScrapeThread htmlThread = new ScrapeThread(htmlDir, ActionType.HTMLScrape);
            htmlThread.start();
        }

        for (File xmlDir : scrapeConf.getXMLDirs()) {
            ScrapeThread xmlThread = new ScrapeThread(xmlDir, ActionType.XMLScrape);
            xmlThread.start();
        }
        
        for (File xmlDir : scrapeConf.getDeleteDirs()) {
            ScrapeThread xmlThread = new ScrapeThread(xmlDir, ActionType.XMLDelete);
            xmlThread.start();
        }
    }
}
